package com.shenwei.yingdaoguanli.utils;

/**
 * @Author wang
 * @Date 2025/2/18 11:39
 * @PackageName:com.shenwei.yingdaoguanli.utils
 * @ClassName: MailConfig
 * @Description: TODO
 * @Version 1.0
 */
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

@Configuration
public class MailConfig {

    @Bean
    public JavaMailSender getJavaMailSender() {
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
        mailSender.setHost("smtp.163.com");
        mailSender.setPort(465);
        mailSender.setUsername("your-email@163.com");
        mailSender.setPassword("your-email-password");

        java.util.Properties props = mailSender.getJavaMailProperties();
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.ssl.trust", "smtp.163.com");

        return mailSender;
    }
}
